package com.cloud.eurekaconsumer.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author kangwen
 */
@RestController
public class EurekaConsumerController {

	@Resource
	private RestTemplate restTemplate;

	@GetMapping("/helloConsumer")
	public String hello() {
		// eureka-provider为spring.application.name
		return restTemplate.getForEntity("http://eureka-provider/hello", String.class).getBody();
	}
}
